<template>
	<view>
		<view class="plr15">
			<view class="plt15 border-bottom" v-for="(item,index) in list" :key="index">
				<view class="flex alcenter item-content">
					<image :src="item.img" mode="" class="img"></image>
					<view class="ml10 fl1">
						<view class="cl-w ft18">{{item.name}}</view>
						<view class="cl-w8 mt10 ft14 text-over2">{{item.text}}</view>
						<view class="flex mt10">
							<view class="label mr10" v-for="it in item.yy">{{it}}</view>
						</view>
					</view>
				</view>
				<view class="mt14 flex ft12">
					<view class="flex alcenter col40">
						<u-icon name="eye" color="#fff" size="18"></u-icon>
						<view class="cl-w8 ml2 text-over">{{$t('text.guankancishu')}}：{{item.views}}</view>
					</view>
					<view class="flex alcenter col20" @click="goRelease(item.id)">
						<u-icon name="file-text" color="#fff" size="18"></u-icon>
						<view class="cl-w8 ml2">{{$t('text.bianji')}}</view>
					</view>
					<view class="flex alcenter col20" @click="record(item.id)">
						<u-icon name="list-dot" color="#fff" size="18"></u-icon>
						<view class="cl-w8 ml2">{{$t('text.zhengjie1')}}</view>
					</view>
					<view class="flex alcenter col20" @click="xiajia(item.id)">
						<u-icon name="trash" color="#fff" size="18"></u-icon>
						<view class="cl-w8 ml2">{{$t('text.xiajia')}}</view>
					</view>
				</view>
			</view>
			<u-empty mode="data" marginTop="300" v-if="list==''">
			</u-empty>
		</view>
		<view style="height: 150rpx;"></view>
		<view class="release">
			<view class="btn" @click="$u.route('/pages/creator/user/releaseVideo/release')">{{$t('play.fabu')}}</view>
		</view>
	</view>

</template>

<script>
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
	export default {
		components: {
			uniLoadMore,
		},
		data() {
			return {
				list: []
			}
		},
		onLoad(e) {
			//console.log(111)
			this.init();
			uni.setNavigationBarTitle({
				title: e.titleName
			})
		},

		methods: {
			async init() {
				let params = {
					language: 0
				}
				let [err, res] = await this.$httpas.get('/api/creator/video_list', params, {
					token: true
				});
				this.list = res.data.data
			},
			xiajia(id) {
				uni.showModal({
					title: this.$t('text.qdxj'),
					success(res) {
						if (res.confirm) {
							let params = {
								id: id,
								status: 'hidden', //normal是上架
							}
							let [err, res] = this.$httpas.get('/api/creator/video_xiajia', params, {
								token: true
							});
							this.init()
						}
					}
				})
			},
			record(id) {
				uni.navigateTo({
					url: '/pages/creator/user/releaseVideo/chapter?id=' + id
				})
			},
			goRelease(id){
				uni.navigateTo({
					url: '/pages/creator/user/releaseVideo/release?id=' + id
				})
			}

		}
	}
</script>

<style lang="scss">
	.item-content {
		width: 100%;

		.img {
			width: 170rpx;
			height: 228rpx;
			border-radius: 20rpx;
		}

		.label {
			background: #292A2E;
			color: rgba(255, 255, 255, 0.8);
			font-size: 24rpx;
			padding: 6rpx 10rpx;
			border-radius: 8rpx;
		}
	}

	.border-bottom {
		border-bottom: 1px solid #28292D;
	}

	.release {
		position: fixed;
		bottom: 0;
		right: 0;
		left: 0;
		background: #000;
		padding: 30rpx;

		.btn {
			background: rgba(11, 144, 249, 1);
			text-align: center;
			border-radius: 50rpx;
			padding: 20rpx 0;
			color: #fff;
		}
	}

	.col40 {
		width: 40%;
	}

	.col20 {
		width: 20%;
	}
</style>